# Importing Data
NORWAY<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Aluminium/Aluminium.xlsx",sheet = "Sheet1", range = "Y1:Y264")

# Checking the Imported Data
View(NORWAY)
# Creating Time Series Data
NORWAY_ts <- ts(NORWAY, start=c(1998,1), end=c(2018,12), frequency=12)
# Viewing and Checking the Created Time Series Data
NORWAY_ts
sum(is.na(NORWAY_ts))
library(forecast)
NORWAY_ts <- tsclean(NORWAY_ts)
NORWAY_ts

# Identification: Plotting the Time Series Data
plot(NORWAY_ts)

# Estimating the appropriate model
NORWAY_ts_model <- auto.arima(NORWAY_ts)
NORWAY_ts_model

# Forecasting
options(max.print=1000000)
NORWAY_ts_forecast <- forecast (NORWAY_ts_model, level=c(95), h=364)
plot(NORWAY_ts_forecast)
NORWAY_ts_forecast             

# Exporting
write.table(NORWAY_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Aluminium/NORWAY_TSA.csv", sep=",")
